﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyMvc.IDAL;
using MyMvc.IBLL;
using MyMvc.Model.Models;
using MyMvc.DAL;
using MyMvc.Model;

namespace MyMvc.BLL
{
    public partial class CategoryTypeService : BaseService<CategoryType>, ICategoryTypeService
    {
        public IQueryable<CategoryType> LoadSearchData(GetModelQuery query)
        {
            //拿到所有数据
            var temp = _dbSession.CategoryTypeRepository.LoadEntities(u => true);
            query.total = temp.Count();
            return temp.Skip(query.pageSize * (query.pageIndex - 1)).Take(query.pageSize).AsQueryable();
        }

      
        public int DeleteType(List<int> DeleteID)
        {
            foreach (var ID in DeleteID)
            {
                _dbSession.CategoryTypeRepository.DeleteEntities(new CategoryType() { ID = ID });
            }
            return _dbSession.SaveChanges();
        }

    }

}
